﻿using System.Collections.Generic;
using System.Linq;
using MonkeyShop.Data.EntityModel;

namespace MonkeyShop.Data
{
    public class ProductDao
    {
        public List<Product> GetProductsInCategory(int catId)
        {
            using (var db = new MonkeyShopEntities())
            {
                var products = from p in db.Products
                               join pc in db.ProductToCategories on p.Id equals  pc.ProductId
                               where pc.CategoryId == catId
                               select p
            }
        }
    }
}
